package Week9;

import java.util.ArrayList;

public class ArrayListIntegerStack implements IntegerStack {

	private java.util.List<Integer> List = new ArrayList<Integer>();

	@Override
	public Integer push(Integer item) {
		if(item == null)
			return null;
		List.add(item);
		return item;
	}

	@Override
	public Integer pop() {
		if(List.size() == 0)
			return null;
		return List.remove(List.size()-1);
	}	
	@Override
	public Integer peek() {
		if(List.size() == 0)
			return null;
		return List.get(List.size()-1);
	}
	
	@Override
	public boolean empty() {
		return List.size()==0?true:false;
	}	
	@Override
	public int size() {
		return List.size();
	}

	@Override
	public String toString() {
		return List.toString();
	}

	
}
